package com.pms.service.impl;

import com.pms.mapper.*;
import com.pms.service.DashboardService;
import com.pms.vo.DashboardCountVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DashboardServiceImpl implements DashboardService {

    @Autowired
    private CommunityMapper communityMapper;
    @Autowired
    private OwnerMapper ownerMapper;
    @Autowired
    private VehicleMapper vehicleMapper;
    @Autowired
    private BuildingMapper buildingMapper;

    /**
     * 统计数据
     * @return
     */
    public DashboardCountVO count() {
        DashboardCountVO dashboardCountVO = DashboardCountVO.builder()
                .communityNum(communityMapper.count())
                .ownerNum(ownerMapper.count())
                .vehicleNum(vehicleMapper.count())
                .buildingNum(buildingMapper.count())
                .build();
        return dashboardCountVO;
    }
}
